export default function updateElementNode(element, virtualDOM) {
  const newProps = virtualDOM.props
  Object.keys(newProps).forEach(propName => {
    const newPropsValue = newProps[propName]
    if (propName.slice(0, 2) === 'on') {
      const eventName = propName.toLowerCase().slice(2)
      element.addEventListener(eventName, newPropsValue)
    } else if (propName === 'value' || propName === 'checked') {
      element[propName] = newPropsValue
    } else if (propName !== "children") {
      if (propName === "className") {
        element.setAttribute("class", newPropsValue)
      } else {
        element.setAttribute(propName, newPropsValue)
      }
    }
  })
}